import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'
import Layout from '@/views/Layout.vue'
import OrderList from '@/views/orders/List.vue'
import ProductList from '@/views/product/List.vue'
import OrderAdd from '@/views/orders/Add.vue'
import LoginView from "@/views/LoginView.vue";
const routes = [
    {path:'/login',name:'Login',component: LoginView},
    {
        path: '/',
        component: Layout,
        children: [
            {
                path: 'order/list',
                name: 'OrderList',
                component: OrderList,
                meta: { title: '订单列表' }
            },
            {
                path: 'order/add',
                name: 'OrderAdd',
                component: OrderAdd,
                meta: { title: '添加订单' }
            },
            {
                path: 'product/list',
                name: 'ProductList',
                component: ProductList,
                meta: { title: '产品列表' }
            },
            //默认重定向
            {
                path: '/',
                redirect: '/login'
            }
        ]
    }
]
const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router